package com.isoftstone.springcloud.framework;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.context.annotation.Bean;
import org.springframework.integration.annotation.InboundChannelAdapter;
import org.springframework.integration.annotation.Poller;
import org.springframework.integration.core.MessageSource;
import org.springframework.messaging.support.GenericMessage;

@SpringBootApplication
@EnableBinding(value = {Source.class})
public class Appliction {

    public static void main(String [] args){
        new SpringApplicationBuilder(Appliction.class).web(true).run(args);
    }

    private static Logger logger = LoggerFactory.getLogger(SinkSender.class);



    @Bean
    @InboundChannelAdapter(value = Source.OUTPUT,poller = @Poller(fixedDelay = "100"))
    public MessageSource<String> timerMessageSource(){
        logger.info("开始启动");
        return  ()-> new GenericMessage<>("testNameIsGood");
    }


}
